import common.CommonFunction;
import common.Mask;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

public var infoObject:Object;

[Embed(source="/images/success.png")]private var successIcon:Class;
[Embed(source="/images/error.png")]private var errorIcon:Class;
[Embed(source="/images/question.png")]private var questionIcon:Class;


public function onCreationComplete():void
{	
	infoObject = new Object();	
	infoObject["userId"] =new Date();
	/**
	 * for call column in buffer_customer_info
	 **/ 
	infoObject["status"] = "2";
	Mask.show(CommonFunction.getConstants('pleaseWait'));	
	getRequests.send(infoObject);
}

public var requestsXML:XML;
public var requestsList:ArrayCollection;
public function onSuccess(event:ResultEvent):void
{	
	Mask.close();	
	requestsXML = event.result as XML;
	requestsList = new ArrayCollection();
	for each(var obj:Object in requestsXML.record)
	{	
		requestsList.addItem({select:false,fromNumber:obj.fromNumber,toNumber:obj.toNumber,
							amount:obj.amount,voucher:obj.voucherType,date:obj.date,
							serviceCharge:obj.serviceCharge,transactionId:obj.transactionId});	
	}
	customerDetailsGrid.dataProvider = requestsList;	
}

public function onFailure(event:FaultEvent):void
{	
	Mask.close();	
	Alert.show("Connection Error..try again");	
}